package kr.hkit.team.score.dto;

public class Score {

	/**
	 * stdNum:	학번
	 * stdName:	이름
	 * kor:		국어점수
	 * eng:		영어점수
	 * math:	수학점수
	 * total:	총점
	 * avg:		평균
	 */
	private int stdNum;
	private String stdName;
	private int kor;
	private int eng;
	private int math;
	private int total;
	private int avg;
	private int rank;
	
	
	public Score() {
		
	}
	

	public Score(int stdNum, int kor, int eng, int math) {
		this.stdNum = stdNum;
		this.kor = kor;
		this.eng = eng;
		this.math = math;
	}



	/**
	 * @Method Name  	: setTotal
	 * @Method Comment  : 총점 구하는 함수
	 */
	public void setTotal() {
		total = kor + eng + math;
	}
	
	/**
	 * @Method Name  	: setAvg
	 * @Method Comment  : 평균 구하는 함수, 소수점 첫 자리에서 반올림
	 */
	public void setAvg() {
		avg = Math.round(total/3);
	}

	public int getStdNum() {
		return stdNum;
	}

	public void setStdNum(int stdNum) {
		this.stdNum = stdNum;
	}

	public String getStdName() {
		return stdName;
	}

	public void setStdName(String stdName) {
		this.stdName = stdName;
	}

	public int getKor() {
		return kor;
	}

	public void setKor(int kor) {
		this.kor = kor;
	}

	public int getEng() {
		return eng;
	}

	public void setEng(int eng) {
		this.eng = eng;
	}

	public int getMath() {
		return math;
	}

	public void setMath(int math) {
		this.math = math;
	}

	public int getTotal() {
		return total;
	}

	public void setTotal(int total) {
		this.total = total;
	}

	public int getAvg() {
		return avg;
	}

	public void setAvg(int avg) {
		this.avg = avg;
	}


	public int getRank() {
		return rank;
	}


	public void setRank(int rank) {
		this.rank = rank;
	}


	@Override
	public String toString() {
		return String.format(
				"입력정보 [학번=%s,국어=%s, 영어=%s, 수학=%s]",
				stdNum, kor, eng, math);
	}
	
	
	
}
